from django.db import models

class Area(models.Model):
    """宝安区"""
    name = models.CharField(max_length=20, verbose_name='名称')
    parent = models.ForeignKey('self', on_delete=models.SET_NULL, related_name='subs', null=True, blank=True, verbose_name='上级行政区划')

    class Meta:
        db_table = 'tb_areas'
        verbose_name = '省市区'
        verbose_name_plural = '省市区'

    def __str__(self):
        return self.name



# gd.area_set.all()
# gd.subs.all()
# sz.parent

# sz.area_set.all()
# sz.sbus.all()
#
#
# HeroInfo
#     hbook
# BookInfo
#     heroinfo_set
# book.heroinfo_set.all()
#
# hero.hbook